@import '~view-design/src/styles/index.less';

@global-header-zindex   : 105;
@css-prefix             : ivu-;
// vertical paddings
@padding-lg    : 24px; // containers
@padding-md    : 16px; // small containers and buttons
@padding-sm    : 12px; // Form controls and items
@padding-xs    : 8px;  // small items

@menu-dark-title: #001529;
@menu-dark-active-bg: #000c17;
@layout-header-background:#001529;
@layout-sider-background: #001529;

body {
  font-size: @font-size-base;
  &.colorWeak {
    filter: invert(80%);
  }
  &.userLayout {
    overflow: auto;
  }
}

.layout.ivu-layout {
  height: auto;
  overflow-x: hidden;
  &.mobile,
  &.tablet {
    .ivu-layout-content {
      .content {
        margin: 24px 0 0;
      }
    }

    /**
     * ivu-table-wrapper
     * 覆盖的表格手机模式样式，如果想修改在手机上表格最低宽度，可以在这里改动
     */
    .ivu-table-wrapper {
      .ivu-table-content {
        overflow-y: auto;
      }
      .ivu-table-body {
        min-width: 800px;
      }
    }
    .topmenu {
      /* 必须为 topmenu  才能启用流式布局 */
      &.content-width-Fluid {
        .header-index-wide {
          margin-left: 0;
        }
      }
    }
  }

  &.mobile {
    .sidemenu {
      .header-fixedHeader {
        &.header-side-opened,
        &.header-side-closed {
          width: 100%;
        }
      }
    }
  }

  &.ivu-layout-has-sider {
    flex-direction: row;
  }

  .trigger {
    line-height: 64px;
    padding: 0 20px;
    cursor: pointer;
    transition: color 0.3s;
    &:hover {
      background: rgba(0, 0, 0, 0.025);
    }
  }

  .topmenu {
    .header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width 0.2s;

      &.header-side-opened {
        width: 100%;
      }

      &.header-side-closed {
        width: 100%;
      }
    }
    /* 必须为 topmenu  才能正常流式布局 */
    &.content-width-Fluid {
      .header-index-wide {
        max-width: unset;
        margin-left: 24px;
      }

      .page-header-index-wide {
        max-width: unset;
      }
    }
  }

  .sidemenu {
    .header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width 0.2s;

      &.header-side-opened {
        width: calc(100% - 220px);
      }

      &.header-side-closed {
        width: calc(100% - 80px);
      }
    }
  }

  .header {
    height: 64px;
    padding: 0 12px 0 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    position: relative;
  }

  .header,
  .top-nav-header {
    .user-wrapper {
      float: right;
      height: 100%;

      .action {
        cursor: pointer;
        padding: 0 12px;
        display: inline-block;
        transition: all 0.3s;
        height: 100%;
        color: rgba(0, 0, 0, 0.65);

        &:hover {
          background: rgba(0, 0, 0, 0.025);
        }

        .avatar {
          margin: 20px 8px 20px 0;
          color: #2d8cf0;
          background: hsla(0, 0%, 100%, 0.85);
          vertical-align: middle;
        }

        .icon {
          font-size: 16px;
          padding: 4px;
        }
      }
    }

    &.dark {
      .user-wrapper {
        .action {
          color: rgba(255, 255, 255, 0.85);
          a {
            color: rgba(255, 255, 255, 0.85);
          }

          &:hover {
            background: rgba(255, 255, 255, 0.16);
          }
        }
      }
    }
  }

  &.mobile,
  &.tablet {
    .top-nav-header {
      .header-index-wide {
        .header-index-left {
          .trigger {
            color: rgba(255, 255, 255, 0.85);
            padding: 0 12px;
          }

          .logo.top-nav-header {
            flex: 0 0 56px;
            text-align: center;
            line-height: 58px;
            h1 {
              display: none;
            }
          }
        }
      }

      &.light {
        .header-index-wide {
          .header-index-left {
            .trigger {
              color: rgba(0, 0, 0, 0.65);
            }
          }
        }
        //
      }
    }
  }

  &.tablet {
    // overflow: hidden; text-overflow:ellipsis; white-space: nowrap;
    .top-nav-header {
      .header-index-wide {
        .header-index-left {
          .logo > a {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
        .ivu-menu.ivu-menu-horizontal {
          flex: 0 1 auto;
          white-space: normal;
        }
      }
    }
  }

  .top-nav-header {
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    position: relative;
    transition: background 0.3s, width 0.2s;

    .header-index-wide {
      max-width: 1200px;
      margin: auto;
      padding-left: 0;
      display: flex;
      height: 64px;

      .ivu-menu.ivu-menu-horizontal {
        max-width: 835px;
        flex: 0 1 835px;
        border: none;
        height: 64px;
        line-height: 64px;
      }

      .header-index-left {
        flex: 0 1 1000px;
        display: flex;

        .logo.top-nav-header {
          flex: 0 0 165px;
          width: 165px;
          height: 64px;
          position: relative;
          line-height: 64px;
          transition: all 0.3s;
          overflow: hidden;

          img,
          svg {
            display: inline-block;
            vertical-align: middle;
            height: 32px;
            width: 32px;
          }

          h1 {
            color: #fff;
            display: inline-block;
            vertical-align: top;
            font-size: 16px;
            margin: 0 0 0 12px;
            font-weight: 400;
          }
        }
      }

      .header-index-right {
        flex: 1 0 auto;
        height: 64px;
        overflow: hidden;

        .content-box {
          float: right;
        }
      }
    }

    &.light {
      background-color: #fff;

      .header-index-wide {
        .header-index-left {
          .logo {
            h1 {
              color: #002140;
            }
          }
        }
      }
    }
  }

  // 内容区
  .layout-content {
    margin: 24px 24px 0px;
    height: 100%;
    height: 64px;
    padding: 0 12px 0 0;
  }

  // footer
  .ivu-layout-footer {
    padding: 0;
  }
}

.topmenu {
  .page-header-index-wide {
    max-width: 1200px;
    margin: 0 auto;
  }
}

// drawer-sider 自定义
.ivu-drawer.drawer-sider {
  .sider {
    box-shadow: none;
  }

  &.dark {
    .ivu-drawer-content {
      background-color: rgb(0, 21, 41);
    }
  }
  &.light {
    box-shadow: none;
    .ivu-drawer-content {
      background-color: #fff;
    }
  }

  .ivu-drawer-body {
    padding: 0;
  }
}

// 菜单样式
.sider {
  box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
  position: relative;
  z-index: 10;
  min-height: 100vh;
  height: 100%;
  .ivu-layout-sider-children {
    overflow-y: hidden;

    &:hover {
      overflow-y: auto;
    }
  }

  &.ivu-fixed-sidemenu {
    position: fixed;
    height: 100%;
  }

  .logo {
    position: relative;
    height: 64px;
    padding-left: 24px;
    overflow: hidden;
    line-height: 64px;
    background: #002140;
    transition: all .3s;

    img,
    svg,
    h1 {
      display: inline-block;
      vertical-align: middle;
    }

    img,
    svg {
      height: 32px;
      width: 32px;
    }

    h1 {
      color: #fff;
      font-size: 20px;
      margin: 0 0 0 12px;
      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
      font-weight: 600;
      vertical-align: middle;
    }
  }

  &.light {
    background-color: #fff;
    box-shadow: 2px 0px 8px 0px rgba(29, 35, 41, 0.05);

    .logo {
      background: #fff;
      box-shadow: 1px 1px 0px 0px #e8e8e8;

      h1 {
        color: unset;
      }
    }

    .ivu-menu-light {
      border-right-color: transparent;
    }
  }
}

a.nav-drop-menu-a {
  width: 100%;
  display: inline-block;
  padding: 0 32px!important;
  height: 40px;
  line-height: 40px;
  color: @text-color;
}

// 导航下拉菜单
.nav-dropdown-menu{
  margin-left: 4px;
  max-height: none;

  .ivu-dropdown-menu{
    min-width: 160px;
    .ivu-dropdown{
      display: block;
      margin: 0;
      padding: 0 16px!important;
      font-size: 14px;
    }
  }
}

// 外置的样式控制
.user-dropdown-menu {
  span {
    user-select: none;
  }
}
.user-dropdown-menu-wrapper.ivu-dropdown-menu {
  padding: 4px 0;

  .ivu-dropdown-item {
    width: 160px;
  }

  .ivu-dropdown-item > .ivu-icon:first-child,
  .ivu-dropdown-item > a > .ivu-icon:first-child{
    min-width: 12px;
    margin-right: 8px;
  }
}



.content {
  // 数据列表 样式
  .table-alert {
    margin-bottom: 16px;
    margin-top: 16px;
  }

  .table-operator {
    margin-bottom: 18px;
  }

  .table-page-search-wrapper {
    .table-page-search-submitButtons {
      display: block;
      margin-bottom: 18px;
      margin-right: 24px;
      white-space: nowrap;
      float: right;
    }
  }

  .table-page-toolbar {
    margin: 16px 0;
    float: right;
  }
}

code, kbd, pre, samp{
  padding: .2em .4em;
  font-size: .9em;
  background: #f6f6f6;
  border: none;
  white-space: pre-wrap;
  vertical-align: middle;
  color: #c7254e;
}

.ivu-dropdown-item > a{
  color: rgba(0, 0, 0, 0.65);
  display: block;
  padding: 5px 12px;
  margin: -5px -12px;
  -webkit-transition: all 0.3s;
  transition: all 0.3s;
}

